var express = require("express");
var router = express.Router();
 
router.get('/',function(req,res){
    res.render('register');
});
router.post('/',(req,res)=>{
let personal= new getVaule(req.body.name,
        req.body.class,
        req.body.password,
        req.body.confirmPassword,
        req.body.phone,
        req.body.emile,
        req.body.habby,
        req.body.sex,
        req.body.username);
    // console.log(personal);
    req.session.user=personal;
    console.log(personal);
    res.send('成功注册!');
});

function getVaule(name , classes, pass , Cpass, phone ,emile ,habby ,sex ,username){
    this.name = name;
    this.classes  = classes;
    this.pass = pass;
    this.Cpass = Cpass;
    this.phone = phone;
    this.emile = emile;
    this.habby = habby;
    this.sex = sex;    
    this.username = username;
}
module.exports= router;